<script language="javascript">
var url = new Array(); 
var imgfile = new Array(); 

function addClone(count){
var clone = $('one').clone().injectAfter('one');
}

function selPrj(id){
	id = id.substring(2);
	$$('img').set('src',"__PUBLIC__/Images/flag_green.ico");
	$('img'+id).set('src',"__PUBLIC__/Images/flag_red.ico");
	var page= parseInt($(id+'pageNum').innerHTML);
	var geziP= parseInt($(id+'geziPerPage').innerHTML);
	var geziT= parseInt(page)*parseInt(geziP);
	$('page').innerHTML = page;
	$('geziP').innerHTML = geziP;
	$('geziT').innerHTML = geziT;
}
function pubPrj1(id)
{
	var prjpage = $('page').innerHTML;
	var geziP = $('geziP').innerHTML ;
	var geziT = $('geziT').innerHTML ;
	$j.messager.confirm('请确认', '确认要创建推广项目？<br/>张数：'+prjpage+'<br/>每张格子数：'+geziP+'<br/>需要支付格子：'+geziT, function(r){
				if (r){
					pubPrj(id);
				}
			});
}
function pubPrj(id){
	if( $chk($('page').innerHTML) && $chk($('geziP').innerHTML) && $chk($('geziT').innerHTML))
	{
		Cookie.write('__page',$('page').innerHTML);
		Cookie.write('__geziP',$('geziP').innerHTML);
		Cookie.write('__geziT',$('geziT').innerHTML);//需要支付的格子数
		var totalgezi = Cookie.read('totalGezi__');//现有格子数
		//alert(totalgezi+':'+parseInt(Cookie.read('__geziT')));
		if( parseInt(Cookie.read('__geziT')) > parseInt(totalgezi) ) 
		{msg('提醒','你拥有格子数为：'+totalgezi+'<br/>不够支付本次项目<br/>请到我的财务充值');}
		else
		{
			var callback = function(data){
			if(data[0]['status']=='ok')
			{
				if(data[0]['data']!=false) 
					{
					$j.messager.alert('支付成功，项目创建OK','请尽快提交推广商品信息、格子优惠券图片<br/>图片格式为jpg 3×3CM');
					//window.top.location.reload();
					}
				else $j.messager.alert('错误!',data[0]['msg']);
			}
			else
			$j.messager.alert('出错了！',data[0]['msg']);
			};
			var urlstr = '__APP__/Admin/checkPay';

			$j.messager.prompt('支付后项目创建', '输入支付密语', function(r){
				if (r)
				{
				var secpay = hex_md5(r);		
				var datastr = 'paySecret='+secpay+'&payNum='+parseInt(Cookie.read('__geziT'))+'&geziP='+parseInt(Cookie.read('__geziP'))+
				'&page='+parseInt(Cookie.read('__page'));
				ajaxGet(urlstr,datastr,callback);	 
				}
			});
		

		}
	}	
	else
		{msg('提醒','请选定推广组合套餐');}
}

	function diyPrj(){
	var page= $('ps').value;
	var geziP = $('pz').value;
	var geziT= page * geziP;	
	
	$('page').innerHTML = $chk(page)?page:'';
	$('geziP').innerHTML = $chk(geziP)?geziP:'';
	$('geziT').innerHTML = $chk(geziT)?geziT:'';
	}


 function upPrj(id){
 	alert('in');
	var urlstr = '__APP__/Prj/upPrj'; 
	datastr = "id_gezi_prj="+id+"&item_url="+$('item_url').value
	+"&describePrj="+$('describePrj').value+"&file_cnt="+$('file_cnt').value+"&geziPerPage="+$('geziPerPage').value;
	var callback = function(data){alert('here');};
	ajaxGet(urlstr,datastr,callback);	
 }
 
 //ajax访问获得项目产品表
 function showDetail(id){
	var urlstr = '__APP__/Prj/getPrjpdt'; 
	datastr = "id_gezi_prj="+id;
	var callback = function(data){msg('展示项目的产品明细记录');};
	ajaxGet(urlstr,datastr,callback);	
 }


function ctaskPrj(){
$j.messager.alert('快捷项目入口','你还可以到交换中心<br/>直接选择有空位的任务加入！','info');
}


function showtasks(id_task,kind,paneldiv)
{
var urlstr = '__APP__/Util/getTaskprjpdtinfo';

	if($chk(paneldiv))
	$j('#'+paneldiv).panel('expand');
initTaskDiv(kind,paneldiv);
seeTask(kind,id_task,urlstr);
}

 function showprj1(index,divid)
 {
	 if(index!='项目ID')
	 {	$(divid+'pageNum').innerHTML=$(divid+'pageNum'+index).value;
		$(divid+'geziPerPage').innerHTML=$(divid+'geziPerPage'+index).value;
		$(divid+'geziNum').innerHTML=$(divid+'geziNum'+index).value;
		$(divid+'ctime').innerHTML=$(divid+'ctime'+index).value;
		$(divid+'owner').innerHTML=$(divid+'owner'+index).value;
		$(divid+'status').innerHTML=$(divid+'status'+index).value;		
		$(divid+'type').innerHTML=$(divid+'type'+index).value;
		$(divid+'id_gezi_prj').innerHTML = index;
		showpdts1(index,divid);	 
	 }
 }	
 
   function showpdts1(prjid,pdtdiv)
  {
  $(pdtdiv).innerHTML ='';  		
	var callback = function(data){
		if(data[0]['status']='ok')
		{
		if($chk(data[0]['data'])) 
		{
		//msg('提醒','显示项目详细信息');
		var recs = data[0]['data']['a'];
		//alert(recs.length);
		//获得项目对应的多个产品，显示图片和淘宝价格
		var htmlstr = "<table><tr>";
			for(i=0;i<recs.length;i++)
			{
			var tCode = recs[i]['tCode'];
			var pPic = recs[i]['pPic'];
			var pName = recs[i]['pName'].substring(0,15);			
		
			var pTprice = recs[i]['pTprice'];			
			var productUrl = recs[i]['productUrl'];
			var prj_pic = recs[i]['prj_pic'];
			br =((i+1)%4)==0?'</tr>':'';
			//alert(i+br);			
			 htmlstr = htmlstr +"<td><a href='"+productUrl+"' target='_blank' border=0 >"+"<img src='"+	pPic+"' alt='"+'优惠码：'+tCode+"' width=80 height=80 /> </a>"+
			"<div style='word-wrap:break-word;width:90px;'>"+pName+"</div> ; 价格："+pTprice+'</td>'+br;			
			}
			htmlstr = htmlstr +'</table>';
			$j('#'+pdtdiv).append(htmlstr);
			$j('#'+pdtdiv).focus();
			//alert(htmlstr);	
		}
		else msg('错误!'+data[0]['msg']);
		}
		};
	var datastr = 'id_gezi_prj='+prjid+'&status='+'beginExec';
	var urlstr = '__APP__/Util/getPrjdtinfo';
	ajaxGet(urlstr,datastr,callback);
  }

</script>


<body style="text-align:center; ">
<div id="rightCt" align="center">

<switch name="_SESSION['UserInfo']['secLevel']" >

<case value="-1">您需要先通过卖家认证，购买格子或者参加任务（需要先加入或者创建团队）获得格子，才可以发布推广项目！</case>

<case value="0">您已申请卖家认证，48小时之内没有通过的，请联系客服旺旺：长胡子的小羊！</case>

<default  />

<php>$sgezi = getGezis();setcookie('totalGezi__',$sgezi[0] , time() + 1800, '/');</php>
		<div id="tabarry" class="easyui-tabs" >
			<div title="创建推广项目" style="padding:10px; height:650px;">
				选定投放多少张，每张多少格子，支付总数格子，项目创建成功<br/>
			<table style="font-size:12px" 	 border="1">
			<th colspan="3">选定套餐</th>
			  <tr>
				<td>投放优惠券张数<br/>/覆盖客户数
				  <label>
				  <select id="ps" onChange="diyPrj()">
					<option value="1000" selected>1000</option>
					<option value="2000">2000</option>
					<option value="3000">3000</option>
					<option value="4000">4000</option>
					<option value="5000">5000</option>
					<option value="6000">6000</option>
					<option value="7000">7000</option>
					<option value="8000">8000</option>
					<option value="9000">9000</option>
					<option value="10000">10000</option>
				  </select>
				</label></td>
				<td>每张投放格子数<br/>
				  /一张优惠券24格
					<select id="pz" onChange="diyPrj()">
					<option value="1">1</option>
					<option value="2" selected>2</option>
					<option value="4">4</option>
					<option value="6">6</option>
					<option value="8">8</option>
										</select></td>
				<td>支付格子        </td>
			  </tr>
			  <tr>
				<td id="page">1000</td>
				<td id="geziP">2</td>
				<td id="geziT">2000</td>
			  </tr>
			</table>
			<input name="" type="button" value="自定义推广项目" onClick="pubPrj1()"/><input name="" type="button" value="快捷项目入口" onClick="ctaskPrj()"/>				
								
			</div>
			<div title="已创建,等待执行" style="padding:10px;"  cache="false" href="__APP__/Prj/execPrjS">
			
			</div>
			<div title="申请执行,等候审核"  style="padding:10px;">
			项目状态为tobeCheck,系统检测商品信息，促销图片是否符合规则
		<div id="myprj1">
		<php>$rtArraympj = getPrjList('tobeCheck','Normal'); $prjList1 = $rtArraympj['a'];$pagempj =$rtArraympj['b'];</php>
				<label style="font-size:12px">选择项目<select  id="selprjid1" onChange="showprj1(this.value,'pdts1')">
				  <option value="项目ID" selected>项目ID</option>				  
				  <volist name="prjList1" id="vo">
				  <option value="{$vo.id_gezi_prj}">{$vo.id_gezi_prj}</option>	
				 </volist>
		      </select>
			  </label>
			  <volist name="prjList1" id="vo">
  				  <input type="hidden" value="{$vo.geziPerPage}" id="pdts1geziPerPage{$vo.id_gezi_prj}"	/>
				  <input type="hidden" value="{$vo.geziNum}" id="pdts1geziNum{$vo.id_gezi_prj}"	/>
				  <input type="hidden" value="{$vo.pageNum}" id="pdts1pageNum{$vo.id_gezi_prj}"	/>
				  <input type="hidden" value="{$vo.ctime}" id="pdts1ctime{$vo.id_gezi_prj}"	/>
				  <input type="hidden" value="{$vo.owner}" id="pdts1owner{$vo.id_gezi_prj}"	/>				  				  				  				  		  
				  <input type="hidden" value="{$vo.type}" id="pdts1type{$vo.id_gezi_prj}"	/>
				  <input type="hidden" value="{$vo.status}" id="pdts1status{$vo.id_gezi_prj}"	/>				  	
				  <input type="hidden" value="{$vo.id_gezi_prj}" id="pdts1id_gezi_prj{$vo.id_gezi_prj}"	/>	
			 </volist>		
		<table style="font-size:12px; width:inherit" border="1">
		<th colspan="9">选中要执行的项目</th>
		<tr bgcolor="#FF9900"><td colspan="9">项目ID:<span id="pdts1id_gezi_prj"></span></td></tr>				
		<tr><td>张数</td><td>格子/每张</td><td>格子总数</td><td>所有人</td><td>创建时间</td><td>类别</td><td>状态</td></tr>	
		<tr><td><span id="pdts1pageNum"></span></td><td><span id="pdts1geziPerPage"></span></td><td colspan="1"><span id="pdts1geziNum"></span></td>
		<td><span id="pdts1owner"></span></td><td><span id="pdts1ctime"></span></td><td><span id="pdts1type"></span></td><td><span id="pdts1status"></span></td></tr>			
		</table>						
		</div>
		<div style="border:#E0ECFF solid 1px; height:300px;" id="pdts1"></div>	
							
			</div>	
		<!--主体内容tab3-->
			<div id="tab3" title="审核通过,尽快加入任务"><br/>
			项目状态为beginExec,项目系统检查并批准执行,<span style="color:#FF9900"><b>尽快到交换大厅</b></span>选择任务加入,开始推广
					<div id="myprj2">
				<php>$rtArraympj2 = getPrjList('beginExec','Normal'); $prjList2 = $rtArraympj2['a'];$pagempj2 =$rtArraympj2['b'];</php>
						<label style="font-size:12px">选择项目<select  id="selprjid2" onChange="showprj1(this.value,'pdts2')">
						  <option value="项目ID" selected>项目ID</option>				  
						  <volist name="prjList2" id="vo">
						  <option value="{$vo.id_gezi_prj}">{$vo.id_gezi_prj}</option>	
						 </volist>
					  </select>
					  </label>
					  <volist name="prjList2" id="vo">
						  <input type="hidden" value="{$vo.geziPerPage}" id="pdts2geziPerPage{$vo.id_gezi_prj}"	/>
						  <input type="hidden" value="{$vo.geziNum}" id="pdts2geziNum{$vo.id_gezi_prj}"	/>
						  <input type="hidden" value="{$vo.pageNum}" id="pdts2pageNum{$vo.id_gezi_prj}"	/>
						  <input type="hidden" value="{$vo.ctime}" id="pdts2ctime{$vo.id_gezi_prj}"	/>
						  <input type="hidden" value="{$vo.owner}" id="pdts2owner{$vo.id_gezi_prj}"	/>			  				  				  				  		
						  <input type="hidden" value="{$vo.type}" id="pdts2type{$vo.id_gezi_prj}"	/>
						  <input type="hidden" value="{$vo.status}" id="pdts2status{$vo.id_gezi_prj}"	/>				  	
						  <input type="hidden" value="{$vo.id_gezi_prj}" id="pdts2id_gezi_prj{$vo.id_gezi_prj}"	/>	
					 </volist>		
				<table style="font-size:12px; width:inherit" border="1">
				<th colspan="9">选择要查看的项目</th>
				<tr bgcolor="#FF9900" ><td colspan="9">项目ID:<span id="pdts2id_gezi_prj"></span></td></tr>				
				<tr><td>张数</td><td>格子/每张</td><td>格子总数</td><td>所有人</td><td>创建时间</td><td>类别</td><td>状态</td></tr>	
				<tr><td><span id="pdts2pageNum"></span></td><td><span id="pdts2geziPerPage"></span></td><td colspan="1"><span id="pdts2geziNum"></span></td>
				<td><span id="pdts2owner"></span></td><td><span id="pdts2ctime"></span></td><td><span id="pdts2type"></span></td>
				<td><span id="pdts2status"></span></td></tr>			
				</table>						
				</div>
				<div style="border:#E0ECFF solid 1px; height:300px;" id="pdts2"></div>	
				
				
				
			</div>
		<!--主体内容tab4-->
			<div id="tab4" title="已加入任务,等候满格"><br/>
			项目状态为为Adding,表示项目加入任务OK，但任务还有空位待其他项目匹配加入<br/>
				<php>$TaskListadd = getTaskList2('Adding');</php>
			<label style="font-size:12px">选择要查看的任务<select  id="myprjtaskid" 
				onChange="if(this.value!='任务ID')showtasks(this.value,'myAddingtask','myprjshowtask1')">
				  <option value="任务ID" selected>任务ID</option>				  
				  <volist name="TaskListadd['a']" id="vo">
				  <option value="{$vo.id_gezi_task}">{$vo.id_gezi_task}</option>
				  </volist>
					</select>
			</label>		
			<!--显示任务的div-->
					<div id="myprjshowtask1" class="easyui-panel" collapsed='true' title="任务细节" left=150 style="width:365px;height:470px;">
					<table>
					<tr  bgcolor="#FF9900"><td colspan="4">正面</td> </tr>
				<tr><td><div id="myAddingtask1"></div></td><td><div id="myAddingtask2"></div></td><td><div id="myAddingtask3"></div></td><td>
				<div id="myAddingtask4"></div></td></tr>
				<tr><td><div id="myAddingtask5"></div></td><td><div id="myAddingtask6"></div></td><td><div id="myAddingtask7"></div></td><td>
				<div id="myAddingtask8"></div></td></tr>
				<tr><td><div id="myAddingtask9"></div></td><td><div id="myAddingtask10"></div></td><td><div id="myAddingtask11"></div></td><td>
				<div id="myAddingtask12"></div></td></tr>
				<tr  bgcolor="#FF9900"><td colspan="4">反面</td> </tr>
				<tr><td><div id="myAddingtask13"></div></td><td><div id="myAddingtask14"></div></td><td><div id="myAddingtask15"></div></td><td>
				<div id="myAddingtask16"></div></td>
				</tr>
				<tr><td><div id="myAddingtask17"></div></td><td><div id="myAddingtask18"></div></td><td><div id="myAddingtask19"></div></td><td>
				<div id="myAddingtask20"></div></td>
				</tr>
				<tr><td><div id="myAddingtask21"></div></td><td><div id="myAddingtask22"></div></td><td><div id="myAddingtask23"></div></td><td>
				<div id="myAddingtask24"></div></td>
				</tr>			
					</table>
					</div><br/>
			</div>
		<!--主体内容tab5-->
			<div id="tab5" title="项目融入任务,查看任务"><br/>
			任务匹配满格，等候印刷，到此为止项目转化为任务，更多状态到我的任务->我加入的任务<br/>
				<php>$TaskListprjfull = getTaskList2('Full');</php>
			<label style="font-size:12px">选择要查看的任务<select  id="myprjtaskid" 
				onChange="if(this.value!='任务ID')showtasks(this.value,'myFullTask','myprjshowtask2')">
				  <option value="任务ID" selected>任务ID</option>				  
				  <volist name="TaskListprjfull['a']" id="vo">
				  <option value="{$vo.id_gezi_task}">{$vo.id_gezi_task}</option>
				  </volist>
					</select>
			</label>	
			<!--显示任务的div-->
					<div id="myprjshowtask2" class="easyui-panel" collapsed='true' title="任务细节" left=150 style="width:365px;height:470px;">
					<table>
					<tr  bgcolor="#FF9900"><td colspan="4">正面</td> </tr>
				<tr><td><div id="myFullTask1"></div></td><td><div id="myFullTask2"></div></td><td><div id="myFullTask3"></div></td><td>
				<div id="myFullTask4"></div></td></tr>
				<tr><td><div id="myFullTask5"></div></td><td><div id="myFullTask6"></div></td><td><div id="myFullTask7"></div></td><td>
				<div id="myFullTask8"></div></td></tr>
				<tr><td><div id="myFullTask9"></div></td><td><div id="myFullTask10"></div></td><td><div id="myFullTask11"></div></td><td>
				<div id="myFullTask12"></div></td></tr>
				<tr  bgcolor="#FF9900"><td colspan="4">反面</td> </tr>
				<tr><td><div id="myFullTask13"></div></td><td><div id="myFullTask14"></div></td><td><div id="myFullTask15"></div></td><td>
				<div id="myFullTask16"></div></td>
				</tr>
				<tr><td><div id="myFullTask17"></div></td><td><div id="myFullTask18"></div></td><td><div id="myFullTask19"></div></td><td>
				<div id="myFullTask20"></div></td>
				</tr>
				<tr><td><div id="myFullTask21"></div></td><td><div id="myFullTask22"></div></td><td><div id="myFullTask23"></div></td><td>
				<div id="myFullTask24"></div></td>
				</tr>			
					</table>
					</div>		<br/>		
			</div>			
		</div>
</switch>

</div>



</body>